﻿@using GoodMan.Infrastructure.Entities.Entity;
@{
    Layout = "~/Views/Shared/_Main.cshtml";
    ItemListBox<Appraise> appraiselist = ViewBag.appraiselist;
    int productId = ViewBag.productId == null ? 0 : ViewBag.productId;
    Product product = ViewBag.product == null ? new Product() : ViewBag.product;

    double totalAppraise = ViewBag.totalAppraise == null ? 5.0d : ViewBag.totalAppraise;
    string Satisfaction = ViewBag.Satisfaction == null ? "100%" : ViewBag.Satisfaction;

    int DelAuthenticate = ViewBag.DelAuthenticate == null ? 0 : ViewBag.DelAuthenticate;
}
<div class="container">
    <ul class="breadcrumb">
        <li><a href="../home/index">首页</a> <span class="divider">></span></li>
        <li class="active">商品评价</li>
    </ul>
    <div class="row">
        <div class="span12">
            <div class="row-fluid">
                <input type="hidden" id="productid" name="id" value="@productId" />
                <div class="group-on-title">
                    <h4>@product.ProductName</h4>
                </div>
            </div>
            <div class="tabbable border-gray">
                <div style="overflow: hidden">
                    <div class="tab-pane" id="tab2" style="overflow: hidden">
                        <h4 class="border-bottom-gray red bg-bar">
                            &nbsp;&nbsp;总体评价</h4>
                        <div class="row-fluid text-center border-bottom-gray evaluate-box">
                            <div class="span4" >
                                @{
                                    <div>
                                        <strong class="text-large red">@totalAppraise</strong> 分</div>
                                    @:<div>
                                    for (int j = 0; j < Math.Round(totalAppraise); j++) 
                                    { 
                                    <img src="/content/img/star.png" /> 
                                    } @:</div>                            
                               }
                            </div>
                            <div class="span4">
                                <div class="border-hv-dot">
                                    <div>
                                        <span class="red">@Satisfaction</span> 的会员满意</div>
                                </div>
                            </div>
                             
                        </div>
                        <h4 class="border-bottom-gray red bg-bar">
                            &nbsp;&nbsp;全部评价</h4>
                        @{
                        if (appraiselist != null && appraiselist.Data != null && appraiselist.Data.Any())
                        {
                            foreach (var Item in appraiselist.Data)
                            {
                                string date = Item.AppraiseDate.ToString("yyyy-MM-dd HH:mm:ss");
                                           
                            <div class="padding-h-10">
                                <div class="row-fluid">
                                    <div class="span8 muted">
                                        @Item.user.NickName &nbsp;&nbsp;&nbsp;@date  &nbsp;&nbsp;&nbsp;
                                        @{
                                            if(DelAuthenticate==1)
                                            {
                                                <a href="/shop/DelAppraise?id=@Item.Id&type=1&productid=@productId&page=@appraiselist.CurrentPage" class="btn btn-danger btn-mini">删除</a>
                                            }
                                         }
                                        
                                    </div>
                                    <div class="span4 text-right">
                                        @{
                                            for (int i = 0; i < Item.AppraiseGrade; i++)
                                            {
                                            <img src="/content/img/star.png" />
                                            }
                                        }
                                        
                                    </div>
                                </div>
                                <small>@Item.AppraiseContent
                                </small>
                            </div>
                            <div class="line-dot">
                            </div>
                            }
                        }
                        }
                    </div>
                    <div class="pagination text-center">
                        @Html.Raw(appraiselist.PageItemSegment)
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
